<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>变量提升</title>
</head>
<body>

    <script>
        console.log(a)
        var a;

        var b = 3;
        (function() {
            console.log(b)
            var b = 'hello';
        })();

        // 报错
        console.log(c)
        c = 2;


        // let const不会提升
        // console.log(c) // Uncaught ReferenceError: Cannot access 'c' before initialization
        // let c = 50;

    </script>
    
</body>
</html>